Java keywords are often referred to as reserved terms. Keywords are specific words that unlock a code. Since these terms are established by Java, they cannot be used as variable, object, or class names.
Java Keywords List
The following is a list of some important Java keywords and reserved words:
-
abstract : A Java abstract class is created with the abstract keyword. The interface implementation may be provided by an abstract class. It may use non-abstract as well as abstract methods.
-
boolean : A variable can be declared as a boolean type by using the Java boolean keyword. Only True and False values are allowed in it
-
break : To terminate a loop or switch statement, use the Java break keyword. When certain circumstances are met, it interrupts the program's current flow.
-
Byte: In Java, you may define a variable that can store 8-bit data values by using the byte keyword.
-
case: To designate text blocks, the Java case keyword is used with switch statements.
-
char: The Java char keyword creates a variable that can store unsigned 16-bit Unicode characters.
-
class: A class is declared using the Java class keyword.
-
carry on :Java's continue keyword is used to keep the loop going. The program's current flow is maintained, and the remaining code is skipped at the required condition
-
default: : The default block of code in a switch statement is specified using the Java default keyword.
-
do: To declare a loop, use the Java do keyword in the control statement. A section of the programme may be iterated over and over again.
-
double: A variable that can store 64-bit floating-point numbers is declared using Java's double keyword.
-
else: The else keyword in a Java if statement is used to denote the alternative branches.
-
Enum: The enum keyword in Java is used to provide a predetermined collection of constants. The default or private enum constructors are both present.
-
extends: In Java, the phrase "extends" is used to show that a class is descended from another class or interface.
-
final: In Java, the word "final" is used to denote that a variable has a constant value. With a variable, it is used. It serves as a barrier against the user changing the variable's value.
-
finally: The Java finally keyword designates a try-catch structural code block. Whether or not an exception is handled, this block is always run.
-
float : The float keyword in Java is used to create a variable that may store a 32-bit floating-point integer
-
for: The for keyword in Java is used to initiate a for loop. It is used to repeatedly carry out a series of commands or operations when a certain condition is met. It is advised to use a for loop if the
number of iterations is fixed.
-
if: The if keyword in Java checks the circumstance. If the criterion is true, the if block is executed.
-
implements: A Java interface can be implemented using the Java implements keyword.
-
instanceof : To determine if an object is an instance of the provided class or implements an interface, use the Java instanceof keyword.
-
import : Class and interface availability and accessibility are made possible via the Java import keyword, which is used in contemporary source code.
-
int: A variable that may store a 32-bit signed integer is declared using the Java int keyword.
-
interface: To declare an interface in Java, use the keyword interface. Only abstract techniques are possible for it.
-
long : A variable that can store a 64-bit integer is declared using the Java long keyword.
-
native: When a method is implemented in native code using JNI, the Java native keyword is used to indicate that.
-
new : The new keyword in Java is used to create new objects.
-
null : Java uses the term null to show that a reference doesn't refer to anything. The junk value is eliminated.
-
private: The access modifier "private" in Java. It serves as a reminder that a method or variable can only be used within the class in which it was declared.
-
protected: A Java access modifier is the keyword protected. Both inside and outside of the package, it may be accessed, but only through inheritance. With the class, it cannot be used.
-
public: The access modifier "public" is used in Java. It is used to suggest that a thing is available everywhere. Its range is the broadest of all the modifiers.
-
return: When a method in Java has finished running, it returns using the return keyword.
-
short : A variable that can store a 16-bit integer is declared using the Java short keyword.
-
static : Java uses the static keyword to denote a variable or method as a class method. Java's static keyword is mostly utilised for memory management.
-
strictfp : To ensure portability, Java strictfp is used to limit the floating-point calculations.
-
super: The super keyword in Java is a reference variable that is used to identify objects from parent classes. It can be utilised to call the direct parent class method.
-
switch: The Java switch keyword includes a switch statement that runs code depending on the results of the test. The switch statement compares a variable's equality to various values.
-
Synchronized: In multithreaded code, the synchronised keyword in Java is used to identify the crucial sections or methods.
-
this: In a method or constructor, the Java this keyword can be used to refer to the current object.
-
throw: To formally throw an exception in Java, use the throw keyword. Custom exceptions are typically thrown using the throw keyword. An illustration follows it.
-
throws: In Java, an exception is declared using the throws keyword. Throws can be used to spread checked exceptions.
-
temporary: : Serialization in Java makes use of the transitory keyword. Any data member that has a transitory definition won't be serialised.
-
try : use the try keyword to begin a block of code that will be checked for exceptions in Java. Either the finally block or the catch must come after the try block
-
void: The void keyword in Java is used to indicate that a method has no return value.
-
volatile: A Java variable can change asynchronously by using the volatile keyword.
-
while: A while loop in Java is started with the while keyword. A section of the programme is iterated several times by this loop. It is advised to utilise the while loop if the number of iterations is not
fixed.
Post your comment